package com.dingding.service;

import com.dingding.util.AccessTokenUtil;
import com.dingding.util.DepartMentUtil;
import com.dingding.util.ProcessUtil;
import com.dingding.util.UserUtil;
import com.dingtalk.api.response.OapiDepartmentListResponse;
import com.dingtalk.api.response.OapiProcessListbyuseridResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description: 流程
 * @author: zyj
 * @create: 2020-03-06 17:25
 **/
@Service
public class ProcessService {

    @Autowired
    AccessTokenUtil accessTokenUtil;

    @Autowired
    DepartMentUtil departMentUtil;

    @Autowired
    ProcessUtil processUtil;

    @Autowired
    UserUtil userUtil;

    /**
    * @Description: 获取部门信息
    * @Param: [id]
    * @return: java.util.List
    * @Author: zyj
    * @Date: 2020/3/10
    */
    public List<OapiDepartmentListResponse.Department> getDept(String id){
        List<OapiDepartmentListResponse.Department> departmentList = departMentUtil.getDeptListByParentId(id);
        return departmentList;
    }

    /**
    * @Description: 根据部门id获取用户信息
    * @Param: [id]
    * @return: java.util.List
    * @Author: zyj
    * @Date: 2020/3/10
    */
    public List getUserByDept(String id, long pageNo, long pageSize){
        List result = userUtil.getUserInfoListByDeptID(Long.parseLong(id), pageNo, pageSize);
        return result;
    }

    /**
    * @Description: 获取所有流程模板列表
    * @Param: [pageNo, pageSize]
    * @return: java.util.List<com.dingtalk.api.response.OapiProcessListbyuseridResponse.ProcessTopVo>
    * @Author: zyj
    * @Date: 2020/3/12
    */
    public List<OapiProcessListbyuseridResponse.ProcessTopVo> listProcess( long pageNo, long pageSize){
        List result = processUtil.listProcess(pageNo, pageSize);
        return result;
    }

}
